package edu.pku.sei.transformation.visitor;

import edu.pku.sei.transformation.mtparser.Ast;
import edu.pku.sei.transformation.mtparser.MTLexer;
import edu.pku.sei.transformation.mtparser.MTParser;

public class MTScriptParser
{
	static public Ast parse(String s) {
		Ast ast = null;
		// System.out.println("parse : "+s);
		try {
			MTLexer Expr_lexer = new MTLexer(s.toCharArray(), null);
			MTParser Expr_parser = new MTParser(Expr_lexer.getILexStream());
			Expr_lexer.lexer(Expr_parser.getIPrsStream());
			ast = Expr_parser.parser();
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Error e) {
			// e.printStackTrace();
		}
		return ast;
	}
}
